home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_01_04
/
1n04058a
< prev
next >
Wrap
Text File
|
1990-08-05
|
2KB
|
114 lines
/* world.cpp */
#include <stdio.h>
#include <stdlib.h>
#include <typedefs.hpp>
extern "C"
{
#include <tiga.h>
#include <extend.h>
}
#define gspMain( ) cp_cmd( USER_CP( gspWorld | 0 ), 0 )
int gspWorld;
int main( int argc, char argv[ ] )
{
if( set_videomode( TIGA, INIT | CLR_SCREEN ) )
{
if( install_primitives( ) >= 0 )
{
gspWorld = install_rlm( "gspWorld.rlm" );
if( gspWorld < 0 )
{
printf("ERROR: could not load gspWorld.rlm\n");
printf("Error code = %d\n", gspWorld );
exit( 7 );
}
gspMain( );
}
else
{
printf( "ERROR: Can not load TIGA primitives.\n" );
return 1;
}
set_videomode( PREVIOUS, NO_INIT );
}
else
{
printf( "ERROR: Please install TIGA and try again.\n" );
return 2;
}
return 0;
}
/* gspWorld.c */
#include <gsptypes.h>
#include <gspglobs.h>
#include <gsptiga.h>
#define XSIZE (config.mode.disp_hres)
#define YSIZE (config.mode.disp_vres)
#define XOR 10
void gspMain( )
{
char* hello;
int tw;
int w, h, i;
/* Get display size */
/* get_config( &config ); */
set_fcolor( WHITE );
set_bcolor( BLACK );
/* Center message on screen */
hello = " H e l l o W o r l d ";
tw = text_width( hello );
text_out( (XSIZE-tw)/2, YSIZE/2, hello );
/* Draw 10 surrounding boxes */
set_ppop( XOR );
for( i = 1; i <= 10; i++ )
{
w = tw + (XSIZE-tw) * i / 10;
h = YSIZE * i / 10;
fill_rect( w, h, (XSIZE-w)/2, (YSIZE-h)/2 );
}
}
/* extWorld.asm */
.width 132
.length 58
.option B, D, L, M, T
;------- Publics --------------------------------
.global _gspMain
;------------------------------------------------
;-------- Tiga Extension List -------------------
.sect ".TIGAISR"
.sect ".TIGAEXT"
.long _gspMain
;------------------------------------------------
.text
.end
/* gspWorld.cmd */
-cr /* C conventions */
-r /* Relocatable output */
-o gspWorld.rlm /* Output file */
-m gspWorld.map /* Map file */
/* Input files */
gspWorld.obj
extWorld.obj